<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>login</title>
    <script src="https://cdn.staticfile.org/jquery/3.6.0/jquery.js"></script>
</head>

<body>
    <div id="app">登录页面
    </div>
    <label for="">账号：</label>
    <input id="zhanghao" type="text">

    <label>密码：</label>
    <input id="mima" type="text">
    <button id="btn">登录</button>

</body>
<script>
    var username=$('#zhanghao').val('admin')
   var password= $('#mima').val('123456')
  $('#btn').click(function(){
    console.log('ok..');
    console.log(username[0].value);
    $.post('/api/login',{username:username[0].value,password:password[0].value}, function (res) {
          // status 为 0 表示登录成功；否则表示登录失败！
          if (res.status === 0) {
            location.href = '/01/index.html'
          } else {
            alert('登录失败！')
          }
    })
  })
   
  
</script>

</html>